<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>大奔农庄</title>
    <link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/> 
    <link rel="stylesheet" href="../../css/swiper.min.css">
    <link rel="stylesheet" href="../../font/iconfont.css">
</head>
<body>
	<div class="swiper-container">
	    <div class="swiper-wrapper" id="swiper-wrapper">

	    </div>
	    <div class="swiper-pagination"></div>
	</div>
	<div class="xinxi-div aui-margin-b-15">
		<div class="xinxi-tit" id="infotitle"></div>
		<div class="xinxi-con" id="infodescription"></div>
			<a href="tel:000-0000-000" id="infophone"><i class="iconfont icon-dianhua-copy aui-margin-t-5 jinrong-dianh aui-text-success"></i></a>
			<a href="javascript:;" id="infoqq" onclick="kefu();" data-qq='' id="infoqq"><i class="iconfont icon-qq aui-margin-l-10 aui-text-success"></i></a>
	</div>
	<div class="aui-content">
	    <ul class="aui-list aui-list-in border-none">
	        <li class="aui-list-item aui-list-item-middle ">
	            <div class="aui-list-item-inner">
	                <div class="aui-list-item-title">产品详情</div>
	            </div>
	        </li>
        </ul>
        <div class="aui-padded-15 aui-grid" id="artinfo"></div>
	</div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/swiper.min.js"></script>
<script>
var myParam,infoUrl;
//初始化
apiready = function(){
    myParam = api.pageParam;
    loadinfo();//加载文章内容
}
//加载文章信息
function loadinfo() {
    var useParam={};
    	useParam.rtk = RSapi.myrtk;
    	useParam.id = myParam.infoid;
    //信息类型
    if(myParam.infotype == 'yy'){
    	infoUrl = RSapi.base+RSapi.yingyuInfo;
    }else if(myParam.infotype == 'sh'){
    	infoUrl = RSapi.base+RSapi.shenghuoInfo;
    }else if(myParam.infotype == 'jr'){
    	infoUrl = RSapi.base+RSapi.jinrongInfo;
    }

    api.ajax({
        url: infoUrl,
        method: 'post',
        cache: false,
        timeout: 30,
        dataType: 'json',
        data: { values: useParam },
    }, function(ret, err){
        if(err){
            //api.toast({msg: JSON.stringify(err)});
            api.toast({msg: err.msg});
        }else {
            if (ret.status>0) { 
                //成功了
                //轮播图
                showslider(ret.xiangce);//显示轮播图           
                //标题
                $api.html($api.byId("infotitle"),ret.info.title);    
                //简介
                $api.html($api.byId("infodescription"),ret.info.description);    
                //电话
                $api.attr($api.byId("infophone"),'href','tel:'+ret.info.phone);  
                //qq
                $api.attr($api.byId("infoqq"),'data-qq',ret.info.qq);        
                //内容
                $api.html($api.dom("#artinfo"),ret.info.content);
                api.parseTapmode();
            }else {
                //失败了
                api.toast({msg: ret.info});
            }
        }
    });
}
//显示轮播图列表
function showslider(list){
	var htmlstr='';
    var i;
    for (i in list) {
    	 htmlstr += '<div class="swiper-slide"><img src="'+list[i].picurl+'"/></div>';
    }
    $api.html($api.byId('swiper-wrapper'),htmlstr);
    slider();//swiper
}
//轮播图
function slider(){
	var swiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        nextButton: '.swiper-button-next',
        prevButton: '.swiper-button-prev',
        paginationClickable: true,
        spaceBetween: 30,
        centeredSlides: true,
        autoplay: 2500,
        autoplayDisableOnInteraction: false
    });
}
//打开qq
function kefu() {
	var number = $api.attr($api.byId('infoqq'), 'data-qq');
	api.openWin({
		name : 'win_webpage',
		url : 'webpage.html',
		pageParam : {
			title:'在线客服',
			url:'http://wpa.qq.com/msgrd?v=3&uin='+number+'&site=qq&menu=yes'
		}
	});
}
</script>
</html>